<div id="addnew_tour_image"></div>
<table>
  <tr>
    <td> 
      <%= link_to 'back', tours_path, class: "btn btn btn-inverse", remote: true %>    
    </td>
  </tr>
</table> <br/>
<div id="tour_images_table">
  <table class="table">
    <thead>
      <tr>
        <th style="text-align:center;"> Images </th>
        <th> Description </th>
        <th style="text-align:center;">Action</th>
      </tr>
    </thead>
    <tbody id="tour_images">
      <% if @tour_images.empty? %>
        <tr id="empty">
          <td>Empty</td>
        </tr>
      <% else %>
        <% @tour_images.each do |tour_list| %>
          <tr id="tr_<%= tour_list.id %>">        
              <td class="text-center">
                <%= image_tag tour_list.image.url(:thumb) %>
              </td>
              <td>
                <%= (tour_list.description_eng.blank?)? "None" : tour_list.description_eng %>
              </td>
              <td class="text-center"> 
                <%= link_to 'Delete', {controller: 'tour_images', action: 'destroy' , id: tour_list.id , tid: params[:tid] }, method: :delete, remote: true, data: { confirm: 'Are you sure?' }, class: "btn btn-danger" %>
              </td>
          </tr>
        <% end %>
      <% end %>
    </tbody>
  </table>
  <div class="collection_paginator">
    <%#= will_paginate tour_images %>
  </div>  
</div>
  
</div>
<%# session[:add_tour_image] = 0 %>
<div id="add_image" class="well">
  <div class="row-fluid">
    <div id="primary_form" class=" span12">
      <%= form_for(@tour_image, :html => {:multipart => true, remote: true, id: "form_tour_image" }) do |f| %>           
          <%= f.hidden_field :tour_id, {value: params[:tid]} %>
          <%= f.file_field :image, class: "checkbox" %>
          <%= f.text_area :description_eng, class: "dec_image", style: "width: 400px; height:25px;", :placeholder => "Image Description ..." %>
          <%= f.submit "Add Image", class: "btn btn-primary checkbox", style: "margin-left:30px;" %> 
      <% end %>
    </div>  
  </div> 
</div>
<div class="row-fluid ">
  <%#= link_to "Add More +", new_tour_image_path, remote: true, class: "btn btn-danger" %>
</div>
